package com.example.zk2.search

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.LayoutInflater
import android.widget.TextView
import com.example.zk2.R
import com.example.zk2.databinding.ActivitySearchBinding
import com.example.zk2.mvvm.BaseViewActivity

class SearchActivity : BaseViewActivity<ActivitySearchBinding>() {
    val hislist = mutableListOf<String>()
    override fun getLayout(): Int {
        TODO("Not yet implemented")
    }

    override fun initView() {
        if(hislist.isNotEmpty()){
            binding.cg.removeAllViews()
            hislist.forEach {
                val keyword = it
                val chip = layoutInflater.inflate(R.layout.item_cg,null)
                chip.findViewById<TextView>(R.id.key).text = it
                binding.cg.addView(chip)
                chip.setOnClickListener {
                    binding.searchView.setQuery(keyword,true)
                }
            }
        }
    }

    override fun initData() {
        TODO("Not yet implemented")
    }

}